<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ include file="/WEB-INF/jsp/include.jsp"%>

<table width="100%" cellpadding="0" cellspacing="0">
    <tr>
        <td height="35" class="gradientV2">
            <div class="block_header_title">
                <c:out value="${usersTable.name}"/>
                <c:if test="${!usersTable.active}">[таблица не активна]</c:if>
            </div>
        </td>
        <td height="35" class="gradientV2" style="text-align:right;">
            <div class="block_header_editbtn_container">
                <a href="http://test.server.ru" class="uiButton">
                    <span class="uiButtonText">Редактировать</span>
                </a>
            </div>
        </td>
    </tr>
</table>

<!-- user's table-->
<table style="border:#CCCCCC solid 0px; height:150px; margin-top:20px; margin-bottom:20px;" align="center" width="725" cellpadding="0" cellspacing="0">
    <tr>
        <td>
            <table border="0" cellspacing="0" cellpadding="0" width="100%">
                <tr>
                    <td width="40%" height="20">
                        <span class="ut_field_title">Продолжительность: </span>
                        <span class="ut_field_value"><c:out value="${usersTable.periodLength}"/> дней</span>
                    </td>
                    <td>
                        <span class="ut_field_title">Повторять в период с</span>
                        <span class="ut_field_value"><fmt:formatDate value="${usersTable.from}" pattern="dd.MM.yyyy"/></span>
                        <span class="ut_field_title">по</span>
                        <span class="ut_field_value"><fmt:formatDate value="${usersTable.to}" pattern="dd.MM.yyyy"/></span>
                    </td>
                </tr>
                <tr>
                    <td colspan="2"  height="35">
                        <span class="ut_field_title">Область видимости: </span>
                        <span class="ut_field_value">всем</span>
                    </td>
                </tr>
            </table>
        </td>
    </tr>

    <c:set var="usersTableFullBlockForm" value="${usersTable.usersTableBlockForm}"/>

    <tr>
        <td>
            <table align="center" cellpadding="0" cellspacing="0">
                <tr>
                    <td>
                        <ul id="carousel_${usersTable.id}" class="usertable_breaf jcarousel-skin-tango_ut_full">
                        <c:forEach var="month" items="${usersTableFullBlockForm.months}">
                        <li><div class="ut_month_in_jcrousel">
                            <table border="0" cellpadding="0" cellspacing="0">
                                <tr>
                                    <td colspan="8" align="center" class="month_year"><fmt:formatDate value="${month.firstDayOfMonth}" pattern="MMMM yyyy"/></td>
                                </tr>
                                <tr>
                                    <td width="30px"></td>
                                    <td class="month_day_name">Пн</td>
                                    <td class="month_day_name">Вт</td>
                                    <td class="month_day_name">Ср</td>
                                    <td class="month_day_name">Чт</td>
                                    <td class="month_day_name">Пт</td>
                                    <td class="month_day_name">Сб</td>
                                    <td class="month_day_name">Вс</td>
                                </tr>
                                <c:forEach var="week" items="${month.weeks}">
                                    <tr>
                                        <td class="week_num">${week.weekNumber}</td>
                                        <c:forEach var="day" items="${week.days}">
                                            <c:choose>
                                                <c:when test="${day != null}">
                                                    <td class="month_day">
                                                        <c:set var="dayMenuForBreifBlock" value="${day}"/>
                                                        <%@include file="../daymenus/dayMenuBreifBlock.jsp"%>
                                                    </td>
                                                </c:when>
                                                <c:otherwise>
                                                    <td class="month_day">
                                                    </td>
                                                </c:otherwise>
                                            </c:choose>
                                        </c:forEach>
                                    </tr>
                                </c:forEach>
                            </table>
                        </div></li>
                        </c:forEach>
                        </ul>
                    </td>
                </tr>
            </table>
        </td>
    </tr>
</table>
<script type="text/javascript">
    $(document).ready(function(){
        var carouselId = "carousel_${usersTable.id}";

        jQuery('.usertable_breaf').show();

        jQuery("#" + carouselId).jcarousel({
            scroll: ${usersTableFullBlockForm.currentMonthIndex},
            start: ${usersTableFullBlockForm.currentMonthIndex}
        });
    });
</script>

<%@include file="../daymenus/dayMenusInCrouselJsHandler.jsp"%>